{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "specific-spectacular",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "preceding-andorra",
   "metadata": {},
   "outputs": [],
   "source": [
    "low_scores = np.array([[44, 78, 81, 48, 39, 47, 38, 69, 60, 65],\n",
    "\n",
    "       [34, 62, 38, 84, 82, 49, 53, 37, 84, 58],\n",
    "\n",
    "       [46, 48, 72, 53, 44, 59, 37, 62, 71, 62]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "cosmetic-envelope",
   "metadata": {},
   "outputs": [],
   "source": [
    "import math"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "arctic-buddy",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "only size-1 arrays can be converted to Python scalars",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-9-caf98a9937da>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mmath\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msqrt\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlow_scores\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m: only size-1 arrays can be converted to Python scalars"
     ]
    }
   ],
   "source": [
    "math.sqrt(low_scores)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "loved-reader",
   "metadata": {},
   "outputs": [],
   "source": [
    "high_scores = np.sqrt(low_scores) * 10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "floating-symposium",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 如何变为整数？当前还是一位小数啊\n",
    "final_scores = np.where(high_scores>60, np.around(high_scores, 0), 'FAIL')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "fantastic-anger",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[['66.0' '88.0' '90.0' '69.0' '62.0' '69.0' '62.0' '83.0' '77.0' '81.0']\n",
      " ['FAIL' '79.0' '62.0' '92.0' '91.0' '70.0' '73.0' '61.0' '92.0' '76.0']\n",
      " ['68.0' '69.0' '85.0' '73.0' '66.0' '77.0' '61.0' '79.0' '84.0' '79.0']]\n"
     ]
    }
   ],
   "source": [
    "print(final_scores)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
